<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:68:"E:\phpCloud\ruanlink\public/../app/spadmin\view\actionlog\index.html";i:1732971886;s:54:"E:\phpCloud\ruanlink\app\spadmin\view\public\base.html";i:1732971886;}*/ ?>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"/>
		<title>后台管理系统</title>
		<!-- 样 式 文 件 -->
		<link rel="stylesheet" href="/assets/library/core/css/core.css?v=<?php echo config('version'); ?>" />
        
	</head>
    <!-- 代 码 结 构 -->
	
<body class="pear-container">
	<div class="layui-card">
		<div class="layui-card-body">
			<form class="layui-form" action="">
                <div class="layui-form-item layui-inline">
                    <label class="layui-form-label">模块</label>
                    <div class="layui-input-inline">
                        <select name="status">
                            <option value="">选择状态</option>
                            <option value="user">用户</option>
                            <option value="spadmin">后台</option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item layui-inline">
                    <label class="layui-form-label">操作</label>
                    <div class="layui-input-inline">
                        <select name="status">
                            <option value="">选择状态</option>
                            <option value="1">操作</option>
                            <option value="2">登录</option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item layui-inline">
                    <label class="layui-form-label">操作日期</label>
                    <div class="layui-inline" id="login_date">
                        <div class="layui-input-inline">
                            <input type="text" autocomplete="off" name="start_date" id="start_date"
                                class="layui-input" readonly placeholder="开始日期">
                        </div>
                        <div class="layui-form-mid">-</div>
                        <div class="layui-input-inline">
                            <input type="text" autocomplete="off" name="end_date" id="end_date" class="layui-input"
                                readonly placeholder="结束日期">
                        </div>
                    </div>
                </div>
                <div class="layui-form-item layui-inline">
                    <button class="pear-btn pear-btn-md pear-btn-primary" lay-submit lay-filter="table-query">
                        <i class="layui-icon layui-icon-search"></i>
                        查询
                    </button>
                    <a href="<?php echo url('index'); ?>" class="pear-btn pear-btn-md" >
                        <i class="layui-icon layui-icon-refresh"></i>
                        重置
                    </a>
                </div>
			</form>
		</div>
	</div>
	<div class="layui-card">
		<div class="layui-card-body">
			<table id="table-list" lay-filter="table-list"></table>
		</div>
	</div>
</body>

    <!-- 资 源 引 入 -->
		<script src="/assets/library/layui/layui.js?v=12<?php echo config('version'); ?>"></script>
		<script src="/assets/library/core/core.js?v=12<?php echo config('version'); ?>"></script>
		<script src="/static/js/qiniu.min.js?v=12<?php echo config('version'); ?>"></script>
	
	<script type="text/html" id="table-toolbar">
		<button class="pear-btn pear-btn-danger pear-btn-md" lay-event="batchRemove">
			<i class="layui-icon layui-icon-delete"></i>
			删除
		</button>
	</script>
	<script type="text/html" id="table-bar">
		<button class="pear-btn pear-btn-danger pear-btn-sm" lay-event="remove"><i class="layui-icon layui-icon-delete"></i></button>
	</script>
	
    
    <script type="text/html" id="table-create_time">
        {{layui.util.toDateString(d.create_time, 'yyyy-MM-dd HH:mm')}}
    </script>
    <script>
        layui.use(['table', 'form', 'jquery', 'common', 'laydate'], function () {
            let laydate = layui.laydate;
            let table = layui.table;
            let form = layui.form;
            let $ = layui.jquery;
            let common = layui.common;
            let cols = [
                    [{
                        type: 'checkbox'
                    },
                    {
                        title: '模块',
                        field: 'title',
                        align: 'center',
                        width: 200
                    },
                    {
                        title: '方式',
                        field: 'typename',
                        align: 'center',
                        width: 200
                    },
                    {
                        title: '操作url',
                        field: 'action',
                        align: 'center',
                        width: 200
                    },
                    {
                        title: '提交方式',
                        field: 'method',
                        align: 'center',
                        width: 200
                    },
                    {
                        title: '参数',
                        field: 'param',
                        align: 'center',
                    },
                    {
                        title: 'IP',
                        field: 'ip',
                        align: 'center'
                    },
                    {
                        title: '操作时间',
                        field: 'create_time',
                        align: 'center',
                        templet: '#table-create_time'

                    },
                    {
                        title: '操作',
                        toolbar: '#table-bar',
                        align: 'center',
                        width: 130
                    }
                    ]
                ]

            table.render({
                elem: '#table-list',
                url: '<?php echo url("index"); ?>',
                parseData: function(res){ 
                return {
                "code": res.code, //解析接口状态
                "msg": res.message, //解析提示文本
                "count": res.data.total, //解析数据长度
                "data": res.data.data //解析数据列表
                }},
                page: true,
                cols: cols,
                skin: 'line',
                toolbar: '#table-toolbar',
                defaultToolbar: [{
                    title: '刷新',
                    layEvent: 'refresh',
                    icon: 'layui-icon-refresh',
                }, 'filter']
            });
            form.on('submit(table-query)', function (data) {
                table.reload('table-list', {
                    where: data.field
                })
                return false;
            });
            table.on('tool(table-list)', function (obj) {
                if (obj.event === 'remove') {
                    common.remove(obj,"<?php echo url('batch'); ?>");
                }
                if (obj.event === 'edit') {
                    common.modalo('<?php echo url("edit"); ?>?ids=' + obj.data['id'],'编辑');
                }
            });

            table.on('toolbar(table-list)', function (obj) {
                if (obj.event === 'add') {
                common.modalo('<?php echo url("add"); ?>','新增');
                } else if (obj.event === 'refresh') {
                    common.refresh();
                } else if (obj.event === 'batchRemove') {
                    common.batchRemove(obj,"<?php echo url('batch'); ?>");
                }else if (obj.event === 'batchadd') {
                    common.batchRemove(obj,"<?php echo url('batchadd'); ?>");
                }
            });
            form.on('switch(table-status)', function (data) {
                let loading = layer.load();
                let field = {};
                field['id']=data.value;
                field[data.elem.name] = data.elem.checked?"1":"0";
                $.ajax({
                    url: '<?php echo url("change"); ?>',
                    type: 'post',
                    data: field,
                    success: function (result) {
                        layer.close(loading);
                        if (result.code == 1) {
                            layer.msg('操作成功', {
                                    icon: 1,
                                    time: 1000
                                })
                        } else {
                            layer.msg(result.msg, {
                                    icon: 2,
                                    time: 1000
                                })
                        }
                    }
                })
            }); 
        })
    </script>

</html>
